Next lowest value in MySQL Database [migrated]

Posted by Justin Edwards on Pro Webmasters See other posts from Pro Webmasters or by Justin Edwards
Published on 2012-09-03T00:59:03Z Indexed on 2012/09/03 3:49 UTC
Read the original article Hit count: 245

Filed under:
SELECT * 
FROM  `experience` 
WHERE  `reqexp` <>  '4793'
ORDER BY  'lvl' DESC 
LIMIT 1

Here is what I want to do. I am making an online game for a client, and need to be able to use a mysql query with a random value, and find the level associated with that amount of experience. In this case, I need to find the next value lower than 4793 that already exists in the database so I can determine the players appropriate level. Any Ideas?

© Pro Webmasters or respective owner

Related posts about mysql